/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.landery.modules.sinco.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.landery.base.BaseEntity;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
 * @website https://el-admin.vip
 * @description /
 * @author landery
 * @date 2022-06-24
 **/
@Entity
@Data
@Table(name="sinco_profit_config")
public class ProfitConfig extends BaseEntity implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "profit_type")
    @ApiModelProperty(value = "收益类型，0邀请用户注册，1邀请用户购买套餐，2api调用")
    private Integer profitType;

    @Column(name = "profit_content")
    @ApiModelProperty(value = "收益内容，与profit_type对应")
    private String profitContent;

    @Column(name = "reword_type")
    @ApiModelProperty(value = "奖励类型，0按付费百分比，1直接金额奖励，2奖励免费次数")
    private Integer rewordType;

    @Column(name = "reword_content")
    @ApiModelProperty(value = "奖励内容，与reword_type对应")
    private String rewordContent;

    @Column(name = "reword")
    @ApiModelProperty(value = "奖励，与reword_type配合使用")
    private Double reword;

    @Column(name = "status")
    @ApiModelProperty(value = "状态，0 禁用，1启用")
    private Integer status;


    public void copy(ProfitConfig source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}